import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Event And Notification Widget Demo"),
      ),
      body: const PointerMoveIndicatorWidget(),
    ),
  ));
}

class PointerMoveIndicatorWidget extends StatefulWidget {
  const PointerMoveIndicatorWidget({Key? key}) : super(key: key);


  @override
  _PointerMoveIndicatorWidgetState createState() => _PointerMoveIndicatorWidgetState();

  }

class _PointerMoveIndicatorWidgetState extends State<PointerMoveIndicatorWidget> {

  PointerEvent? _event;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 500,
      height: 500,
      color: Colors.green,
      child: Listener(
        //  IgnorePointer和AbsorbPointer
        child: AbsorbPointer(
          child: UnconstrainedBox(
            child: Listener(
              child: Container(
                color: Colors.red,
                width: 200.0,
                height: 100.0,
              ),
              onPointerDown: (event) => print("in"),
            ),
          ),
        ),
        onPointerDown: (event) => print("out"),
      ),
    );
  }
}
